home *** CD-ROM | disk | FTP | other *** search
/ CICA 1995 September (Japanese) / CICA Shareware for Windows CD-ROM (Walnut Creek) (September 1995) (Japanese) (Disc 2).iso / disc2 / patches / symantec / mfcsm2.exe / SIMNEW.EXE / MFC / SAMPLES / DOCTEMP / VIEW.WMC < prev    next >
Encoding:
Text File  |  1993-10-06  |  6.0 KB  |  223 lines

  1. // Filename: VIEW.WMC                                       
  2. // "DOCTEMP" Generated by Visual Programmer.                
  3. // Author:   Blue Sky                                       
  4.  
  5. // 
  6. // ***********************************************************************
  7. // Do not add code here. Add code in the .CPP file.
  8. // 
  9. // This file is maintained by the Switch-It Module.
  10. // As you make changes in your applications design,
  11. // this file is automatically updated, therefore you never modify this file.
  12. // 
  13. // 
  14. // 
  15. // For more information,
  16. // see the section "How code is generated" in the documentation.
  17. // 
  18. // ***********************************************************************
  19. // 
  20.  
  21.  
  22. // ----------------------------------------------------------------------------
  23. #ifndef WMCLASSONLY
  24. // ----------------------------------------------------------------------------
  25.  
  26.  
  27.  
  28.  
  29. // *************************************************************
  30. // Member Functions for Class: Cwm_VIEWBaseWnd
  31. // Base Class                : CEditView
  32. // *************************************************************
  33.  
  34.  
  35. CString Cwm_VIEWBaseWnd::ms_strWndClass; //Window Class Name
  36.  
  37.  
  38. IMPLEMENT_DYNCREATE(Cwm_VIEWBaseWnd, CEditView)
  39.  
  40. BEGIN_MESSAGE_MAP(Cwm_VIEWBaseWnd, CEditView)
  41.  
  42.     ON_REGISTERED_MESSAGE(wPrivateMessage,SimHandlePrivateMessage)
  43.  
  44. END_MESSAGE_MAP()
  45.  
  46.  
  47.  
  48. Cwm_VIEWBaseWnd::Cwm_VIEWBaseWnd()
  49.     : CEditView()
  50. {
  51.  
  52.     ms_pToolbarTop= ms_pToolbarBottom=ms_pToolbarLeft=ms_pToolbarRight=NULL;
  53.     ms_pWndClient = NULL;
  54.  
  55.  
  56.     if (ms_strWndClass.IsEmpty())
  57.        SimRegisterClass();
  58.  
  59. }
  60.  
  61.  
  62.  
  63. Cwm_VIEWBaseWnd::~Cwm_VIEWBaseWnd()
  64. {
  65. }
  66.  
  67.  
  68.  
  69. BOOL Cwm_VIEWBaseWnd::SimRegisterClass()
  70. {
  71.     WNDCLASS    WndClass;
  72.  
  73.     WndClass.lpszClassName = "BLD_VIEW";
  74.     WndClass.style         = CS_DBLCLKS;
  75.     WndClass.cbClsExtra    = 0;
  76.     WndClass.cbWndExtra    = 0;
  77.     WndClass.hInstance     = AfxGetInstanceHandle();
  78.     WndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
  79.     WndClass.hCursor       = LoadCursor(NULL,IDC_ARROW);
  80.     WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
  81.     WndClass.lpszMenuName  = NULL;
  82.  
  83.     if (!ms_strWndClass.IsEmpty())
  84.         return TRUE;                      // Already registered
  85.  
  86.     ms_strWndClass = AfxRegisterWndClass(WndClass.style,
  87.        WndClass.hCursor, WndClass.hbrBackground, WndClass.hIcon);
  88.  
  89.     if (ms_strWndClass.IsEmpty())
  90.         return FALSE;
  91.     else
  92.         return TRUE;
  93. }
  94.  
  95.  
  96.  
  97. BOOL Cwm_VIEWBaseWnd::SimInitWindow(CWnd *pAParent)
  98. {
  99.     CREATESTRUCT        sCr;
  100.  
  101.     if (ms_strWndClass.IsEmpty())
  102.        return FALSE;
  103.  
  104.     sCr.lpCreateParams  = NULL;
  105.     sCr.hInstance       = AfxGetInstanceHandle();
  106.     sCr.dwExStyle       = 0;
  107.     sCr.lpszClass       = ms_strWndClass;
  108.     sCr.lpszName        = "VIEW";
  109.     sCr.style           = WS_CHILD | WS_CAPTION | WS_THICKFRAME | WS_CLIPSIBLINGS | WS_SYSMENU;
  110.     sCr.hwndParent      = pAParent ? pAParent->GetSafeHwnd() : (HWND)NULL;
  111.     sCr.x               = CW_USEDEFAULT;
  112.     sCr.y               = 0;
  113.     sCr.cx              = CW_USEDEFAULT;
  114.     sCr.cy              = 0;
  115.     sCr.hMenu           = NULL;
  116.  
  117.  
  118.     CCreateContext            CContext;
  119.  
  120.     // MFC needs a pointer to a CCreateContext
  121.     CContext.m_pNewViewClass  =NULL;
  122.     CContext.m_pCurrentDoc    =NULL;
  123.     CContext.m_pNewDocTemplate=NULL;
  124.     CContext.m_pLastView      =NULL;
  125.     CContext.m_pCurrentFrame  =NULL;
  126.  
  127.     if (!Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,
  128.                 CRect(0,0,0,0),pAParent,AFX_IDW_PANE_FIRST,&CContext))
  129.         {
  130.         BLDDisplayMessage(::GetActiveWindow(),BLD_CannotCreateWindow,"VIEW",
  131.                           MB_OK | MB_ICONASTERISK);
  132.         return FALSE;
  133.         }
  134.  
  135.     ShowWindow(SW_SHOW);
  136.     UpdateWindow();
  137.  
  138.     if (pAParent)
  139.         {
  140.         if (pAParent->IsKindOf(RUNTIME_CLASS(CFrameWnd)))
  141.             {
  142.             CFrameWnd* pFrame;
  143.             pFrame     = (CFrameWnd*)pAParent;
  144.             pFrame->RecalcLayout();
  145.             }
  146.         }
  147.  
  148.     return TRUE;
  149. }
  150.  
  151.  
  152.  
  153. // PreCreateWindow - overridden for window to get correct properties
  154. BOOL Cwm_VIEWBaseWnd::PreCreateWindow(CREATESTRUCT& sCr)
  155. {
  156.     return CEditView::PreCreateWindow(sCr);
  157. }
  158.  
  159.  
  160.  
  161. void Cwm_VIEWBaseWnd::OnDraw(CDC* pDC)
  162. {
  163. }
  164.  
  165.  
  166.  
  167.  
  168. LRESULT Cwm_VIEWBaseWnd::SimHandlePrivateMessage(WPARAM wParam,LPARAM lParam)
  169. {
  170.     LPBLDSetChildDialog lpSetChildDialog;
  171.     switch(wParam)
  172.         {
  173.     case SIM_GETCHILDDIALOG:
  174.         switch(LOWORD(lParam))
  175.             {
  176.         case 0: //Client area controls
  177.             return (LRESULT)(LPSTR)(CSimClientDlg*)ms_pWndClient;
  178.         case CBRS_RIGHT:
  179.             return (LRESULT)(LPSTR)(CSimToolbar*)ms_pToolbarRight;
  180.         case CBRS_LEFT:
  181.             return (LRESULT)(LPSTR)(CSimToolbar*)ms_pToolbarLeft;
  182.         case CBRS_BOTTOM:
  183.             return (LRESULT)(LPSTR)(CSimToolbar*)ms_pToolbarBottom;
  184.         case CBRS_TOP:
  185.             return (LRESULT)(LPSTR)(CSimToolbar*)ms_pToolbarTop;
  186.             }
  187.         break;
  188.     case SIM_SETCHILDDIALOG:
  189.         lpSetChildDialog = (LPBLDSetChildDialog)lParam;
  190.         switch(lpSetChildDialog->nStyle)
  191.             {
  192.         case 0: //Client area controls
  193.             ms_pWndClient     = (CSimClientDlg*)lpSetChildDialog->pWnd;
  194.             break;
  195.         case CBRS_RIGHT:
  196.             ms_pToolbarRight  = (CSimToolbar*)lpSetChildDialog->pWnd;
  197.             break;
  198.         case CBRS_LEFT:
  199.             ms_pToolbarLeft   = (CSimToolbar*)lpSetChildDialog->pWnd;
  200.             break;
  201.         case CBRS_BOTTOM:
  202.             ms_pToolbarBottom = (CSimToolbar*)lpSetChildDialog->pWnd;
  203.             break;
  204.         case CBRS_TOP:
  205.             ms_pToolbarTop    = (CSimToolbar*)lpSetChildDialog->pWnd;
  206.             break;
  207.             }
  208.         break;
  209.     case SIM_RELOADACCELERATORS:
  210.         break;
  211.     case SIM_LOADACCELTABLE:
  212.         return 0;
  213.         break;
  214.         }
  215.     return 0;
  216. }
  217.  
  218.  
  219. // ----------------------------------------------------------------------------
  220. #endif //WMCLASSONLY
  221. // ----------------------------------------------------------------------------
  222.  
  223.